import { useStore } from '../store/store'
export function userPermission(pageName: string, handelName: string) {
  const store = useStore()
  const Permission = store.state.login.permission
  //console.log(Permission)

  const verifyPermission = `system:${pageName}:${handelName}`

  return !!Permission.find((item: any) => item.permission === verifyPermission)
}

// export function usePermission(pageName: string, hanldeName: string) {
//   const store = useStore()
//   const permissions = store.state.login.permission
//   const verifyPermission = `system:${pageName}:${hanldeName}`

//   // name = "coderwhy"
//   // !name -> false
//   // !!name -> true
//   return !!permissions.find((item: any) => item === verifyPermission)
// }
